$(function () {
    let res = myAjax("/common", {}, 'get');
    console.log(res);
    setCompanyData(res.companyDTO);
    setNavData(res.navDTOList);

})

function setCompanyData(data) {
    console.log(data);
    $("#logo").attr("src", data.logo);
    $("#phone").html(data.phone);
    $("#net").html("网址: " + data.net);
    $("#email").html(" 邮箱:" + data.email + "联系电话:" + data.linePhone + "(座机)");
    $("#address").html("联系地址:" + data.address);
    $("#version").html(data.version);

}

function setNavData(data) {
    // let str="中华'\"人民\"共和国'";
    // console.log(str);
    // str='中华""人民"共和国"';
    // console.log(str);
    let html = '';
    for (let i = 0; i < data.length; i++) {
        html += '<div onclick="goToPage(\'' + data[i].href + '\')">' + data[i].title + '</div>';
    }
    $("#nav").html(html);
}

function goToPage(url) {
    sessionStorage.setItem("cuisineId", null);
    sessionStorage.setItem("newsStyleId", null);
    window.location.href = url;
}
